unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, Grids, DBGrids, StdCtrls, DB, DBTables;

type
  TFormMain = class(TForm)
    DBGrid1: TDBGrid;
    Panel1: TPanel;
    ButtonView: TButton;
    EditDBfPath: TEdit;
    DataSource1: TDataSource;
    Table1: TTable;
    procedure ButtonViewClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormMain: TFormMain;

implementation

{$R *.dfm}

procedure TFormMain.ButtonViewClick(Sender: TObject);
var
  sMsg,sFileName,sDBName,sTableName : string;
begin
  sFileName := Trim(EditDBfPath.Text);
  sDBName := ExtractFilePath(sFileName);
  if sDBName[Length(sDBName)] ='\' then
    Delete(sDBName,Length(sDBName),1);

  sTableName := ExtractFileName(sFileName);

  if Table1.Active then Table1.Close;
  
  Table1.DatabaseName := sDBName;
  Table1.TableType := ttDBase;
  Table1.TableName := sTableName;
  Table1.Active := True;

end;

end.
